package com.eclink.asset.consume.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.eclink.asset.consume.domain.dao.ConsumeInventory;
import com.eclink.asset.consume.domain.dto.ConsumeInventoryQueryDTO;
import com.eclink.asset.consume.service.ConsumeInventoryService;
import com.ruoyi.common.core.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 耗材实时库存接口Controller
 *
 * @author chenshixian
 * @date 2024-08-24
 */
@Api("耗材实时库存接口")
@RestController
@RequestMapping("/consume/inventory")
public class ConsumeInventoryController extends BaseController {

    @Resource
    private ConsumeInventoryService service;

    @ApiOperation("查询")
    @PostMapping("/list")
    public ResponseEntity<PageImpl<ConsumeInventory>> list(@RequestBody ConsumeInventoryQueryDTO query, Pageable page) {
        Page<ConsumeInventory> res = service.getInventoryList(query, page);
        return ResponseEntity.ok(new PageImpl<>(res.getRecords(), page, res.getTotal()));
    }

}
